package jian.java.Object;

public class BasicObject {

	public static void main(String[] args) {

		String str1 = 1 + 2 + "Hello";
		System.out.println(str1);
		// 输出3Hello

		String str2 = "Hello" + 1 + 2;
		System.out.println(str2);

		Son s1 = new Son();
		s1.setName("Tom's Son");

		Father f1 = new Father();
		f1.setName("Tom");
		f1.setSon(s1);

		Father f2 = new Father();
		f2.setName("Jerrey");
		f2.setSon(f1.getSon());
		f2.getSon().setName("Jerrey's son");

		System.err.println(s1.getName());
		System.err.println(f1.getSon().getName());
		System.err.println(f2.getSon().getName());
	}
}

class Father {

	protected String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	private Son son;

	public Son getSon() {
		return son;
	}

	public void setSon(Son son) {
		this.son = son;
	}

}

class Son extends Father {

}
